/**
 * @example 
import Timer from '@services/timer?worker'

const time = ref<number>(0)

function counter() {
  const timer = new Timer()
  timer.onmessage = (ev) => {
    time.value = ev.data
  }
  timer.postMessage(5)
}
 */

let n = 0;

onmessage = (ev) => {
  n = ev.data || 0;
  setInterval(() => postMessage(++n), 1000);
};
